<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <%@ include file="/platform/style.jsp"%>

</head>
<style>
    .serch{
        margin: 5px;
        padding: 4px 10px;
        background: #1C84C6;
        border-radius: 5px;
        color: #fff;
        text-decoration: none;
    }
    .Status{
        height: 26px;
        width: 80px;
    }
    .searchinput{
        width: 170px;
        height: 26px!important;
    }
    .ui-pagination {
        padding-bottom: 50px;
    }
</style>
<script>
    function query(){
        $w.execForm();
    }
</script>
<body class="easyui-layout">
<div data-options="region:'center'" class="bodybg">
    <!-- 查询区域 -->
    <form id="queryForm" action="/integral/IntegralPage.page" method="post">
        <w:hidden bind="pageNum"/>
        <w:hidden bind="pageSize_"/>
        <div class="panel">
            <div class="easyui-panel ui-queryBar panel-body panel-body-noheader panel-body-noborder" border="false"
                 data-options="doSize:false">
                <table cellpadding="0" id="tablepromot" cellspacing="0" style="margin-top:5px">
                    <tbody>
                    <tr>
                        <td width="100" align="right">客户编号：</td>
                        <td><w:text bind="bean.id" style="width:180px;height: 26px;"/></td>
                        <td width="100" align="right">企业名称：</td>
                        <td><w:text bind="bean.NAME" style="width:180px;height: 26px;"/></td>
                        <td width="100" align="right">联系电话：</td>
                        <td><w:text bind="bean.phone" style="width:180px;height: 26px;"/></td>
                        <td width="100" align="right">客户来源：</td>
                        <td><select name="bean.source"><option value="">全部</option><w:option bind="bean.source" value="1">PC端</w:option><w:option bind="bean.source" value="2">微信</w:option><w:option bind="bean.source" value="3">后台</w:option></select></td>
                        <td>
                            <a href="javascript:;" class="easyui-linkbutton" iconCls="icon_search" onclick="query()">查询</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="ui_line" style="margin-top:10px"></div>
        <!-- 数据列表区域 -->
        <table class="ui-table" width="100%" data-options="showPage:true,form:'queryForm',pageNum:<w:write bind="pageNum"/>,pageSize:<w:write bind="pageSize_"/>,total:<w:write bind="pagination.totalCount"/>" cellpadding="1" cellspacing="1">
            <thead>
            <tr class="ui_th">
                <td>客户编号</td>
                <td>企业名称</td>
                <td>联系电话</td>
                <td>客户来源</td>
                <td>价格等级</td>
                <td>会员等级</td>
                <td>积分余额</td>
                <td width="110" align="center">操作</td>
            </tr>
            </thead>
            <tbody id="ui_tr">
            <w:iterate id="info" bind="resultList_">
            <tr class="ui_td">
                <td><w:write bind="#info.ID"/></td>
                <td><w:write bind="#info.name"/></td>
                <td><w:write bind="#info.phone"/></td>
                <td><w:write bind="#info.source" defaultVal="PC端" format="[未知,PC端,微信,后台]"/></td>
                <td><w:write bind="#info.pricegrade"/>价</td>
                <td><w:write bind="#info.grade" format="[,普通客户,高级客户,白金客户]"/></td>
                <td class="pid"><w:write bind="#info.integral"/></td>
                <td align="center">
                    <a href="javascript:void(0);" class="ui_btn_2" onclick="integralDetails(<w:write bind="#info.ID"/>,'<w:write bind="#info.name"/>',<w:write bind="#info.integral"/>);">收支详情</a>
                    <a href="javascript:void(0);" class="ui_btn marginR8" onclick="integralModify(<w:write bind="#info.ID"/>);" >积分修改</a>
                </td>
            </tr
           </w:iterate>
            </tbody>
        </table>
        <div style="width: 100%;  text-align: center; position: absolute;z-index: 10000;bottom:0;background-color: #eee" class="ui-buttonBar ui-btn">
            <div style="font-weight: bold;width: 40%;float: right;">积分余额合计:<span id="sumintegral"></span></div>
        </div>
    </form>
</div>
<script>
    function query(){
        $w.execForm({pageNum:1})
    }
    function integralDetails(id,company_nane,ingl){
        $w.openDialog({url:ctx+'/integral/IntegralPage@show.page?bean.id='+id + "&bean.name=" +company_nane +"&bean.integral=" +ingl,title:"积分收支详情",w:700,h:450,maximized:true,afterClose:function(re){
            if(re){
                query();
            }
        }});
    }

    function integralModify (id){
        window.parent.$w.openDialog({url:ctx+'/integral/IntegralPage@integralModify.page?bean.id='+id,title:"积分修改",w:500,h:200,afterClose:function(re){
            if(re)query();
        }});
    }


    $(function () {
        var sum = 0;
        $("#ui_tr tr .pid").each(function () {
            var txt = parseInt($(this).text());
           sum =sum + txt;
        })

        document.getElementById("sumintegral").innerHTML=sum;

    })

/*    $(function(){
        //使用jquery 取得table 中td里面的值
        for(var i=0; i<20;i++) {
$(".ui_td td").eq(7).text();

            var t1 = $("tbody tr>td:nth-child(6)").text;
            alert(t1);
        }
       alert(t1);

    });*/
    
</script>
</body>
</html>
